﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text.RegularExpressions;

namespace WebShop.Classes
{
    /// <summary>
    /// Validate data
    /// </summary>
    public class Validate
    {
        /// <summary>
        /// E-mail validate
        /// </summary>
        /// <param name="inputEmail">text</param>
        /// <returns>true if its email</returns>
        public static bool isEmail(string inputEmail)
        {
            bool result = false;

            if (!String.IsNullOrWhiteSpace(inputEmail)) {
                string strRegex = @"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" +
                      @"\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" +
                      @".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$";
                Regex re = new Regex(strRegex);
                result = re.IsMatch(inputEmail);
            }
        
            return result;
        }
    }
}